package com.huizu.project.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.huizu.common.annotation.Log;
import com.huizu.common.core.controller.BaseController;
import com.huizu.common.core.domain.AjaxResult;
import com.huizu.common.enums.BusinessType;
import com.huizu.project.domain.ProSpReview;
import com.huizu.project.service.IProSpReviewService;
import com.huizu.common.utils.poi.ExcelUtil;
import com.huizu.common.core.page.TableDataInfo;

/**
 * 视频评论Controller
 * 
 * @author zhangmx
 * @date 2024-06-05
 */
@RestController
@RequestMapping("/project/prospreview")
public class ProSpReviewController extends BaseController
{
    @Autowired
    private IProSpReviewService proSpReviewService;

    /**
     * 查询视频评论列表
     */
    @PreAuthorize("@ss.hasPermi('project:prospreview:list')")
    @GetMapping("/list")
    public TableDataInfo list(ProSpReview proSpReview)
    {
        startPage();
        List<ProSpReview> list = proSpReviewService.selectProSpReviewList(proSpReview);
        return getDataTable(list);
    }

    /**
     * 导出视频评论列表
     */
    @PreAuthorize("@ss.hasPermi('project:prospreview:export')")
    @Log(title = "视频评论", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, ProSpReview proSpReview)
    {
        List<ProSpReview> list = proSpReviewService.selectProSpReviewList(proSpReview);
        ExcelUtil<ProSpReview> util = new ExcelUtil<ProSpReview>(ProSpReview.class);
        util.exportExcel(response, list, "视频评论数据");
    }

    /**
     * 获取视频评论详细信息
     */
    @PreAuthorize("@ss.hasPermi('project:prospreview:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") String id)
    {
        return success(proSpReviewService.selectProSpReviewById(id));
    }

    /**
     * 新增视频评论
     */
    @PreAuthorize("@ss.hasPermi('project:prospreview:add')")
    @Log(title = "视频评论", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody ProSpReview proSpReview)
    {
        return toAjax(proSpReviewService.insertProSpReview(proSpReview));
    }

    /**
     * 修改视频评论
     */
    @PreAuthorize("@ss.hasPermi('project:prospreview:edit')")
    @Log(title = "视频评论", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody ProSpReview proSpReview)
    {
        return toAjax(proSpReviewService.updateProSpReview(proSpReview));
    }

    /**
     * 删除视频评论
     */
    @PreAuthorize("@ss.hasPermi('project:prospreview:remove')")
    @Log(title = "视频评论", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable String[] ids)
    {
        return toAjax(proSpReviewService.deleteProSpReviewByIds(ids));
    }
}
